import type { VNodeChild } from 'vue'

export interface IUnknownObjProps {
  [key: string]: unknown
}

export interface IFieldProps {
  label: string
  prop: string
  type?: string
  add?: boolean
  edit?: boolean
  search?: boolean
  import?:
    | boolean
    | {
        required?: boolean
      }
  export?: boolean
  align?: 'center' | 'left' | 'right'
  width?: string | number
  minWidth?: string | number
  slot?: boolean
  disabled?: boolean
  select?: boolean
  filter?: boolean
  sort?: boolean
  fixed?: boolean
  isTag?: boolean
  options?: {
    label: string
    value: unknown
  }[]
}

export interface IConfigProps {
  name?: string
  rowKey?: string
  url?: string
  selection?: boolean
  add?:
    | boolean
    | {
        title?: string
      }
  delete?: boolean
  expand?: boolean
  showIndex?: boolean
  import?: boolean
  export?: boolean
  search?: boolean
  advancedSearch?: boolean
  refresh?: boolean
  settings?: boolean
  operateWidth?: number
  operate?:
    | boolean
    | {
        show?: boolean
        width?: number
        label?: string
      }
}

export interface ITableQuery {
  [key: string]: unknown
}

export interface ITableFilter {
  relation: 'or' | 'and'
  fields: Array<{
    field: string
    oper: string
    value?: unknown
  }>
}

export interface ITableSort {
  prop: string
  order: 'descending' | 'ascending' | null
}

export interface ITableSelection {
  id: string
  [key: string]: unknown
}

export interface ISlots {
  [key: string]: () => VNodeChild
}

export interface IPaginationResult {
  list: unknown[]
  page: number
  pageSize: number
  total: number
  totalPages: number
}
